package com.lx.design.demo.ddd3.oop.monster;

import com.lx.design.demo.ddd3.oop.player.Player;
import com.lx.design.demo.ddd3.oop.weapon.DamageTypeEnum;
import com.lx.design.demo.ddd3.oop.weapon.Weapon;

/**
 * @author lx
 * @date 2021/4/21 16:13
 */
public class Orc extends Monster {
    private Orc(){

    }
    public Orc(String name,long hp){
        super.setName(name);
        super.setHealth(hp);
    }

    @Override
    public void receiveDamageBy(Weapon weapon, Player player) {
        if (weapon.getDamageType() == DamageTypeEnum.PHYSICAL.getCode()) {
            //ocr 物理防御规则
            this.setHealth(this.getHealth() - weapon.getDamage() / 2);
        } else {
            super.receiveDamageBy(weapon, player);
        }
    }
}
